import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

// 生物事件路由
const rEvents = [
  {
    path: "/data/events/warfare",
    name: "Warfare",
    component: resolve => (require(["@/components/Data/Events/Warfare"], resolve)),
  },
  {
    path: "/data/events/warfare/:type/:id",
    name: "WarfareEdit",
    component: resolve => (require(["@/components/Data/Events/WarfareEdit"], resolve)),
  },
  {
    path: "/data/events/warfare/:type",
    name: "WarfareAdd",
    component: resolve => (require(["@/components/Data/Events/WarfareEdit"], resolve)),
  },
  {
    path: "/data/events/bioterrorism",
    name: "Bioterrorism",
    component: resolve => (require(["@/components/Data/Events/Bioterrorism"], resolve)),
  },
  {
    path: "/data/events/bioterrorism/:type/:id",
    name: "BioterrorismEdit",
    component: resolve => (require(["@/components/Data/Events/BioterrorismEdit"], resolve)),
  },
  {
    path: "/data/events/bioterrorism/:type",
    name: "BioterrorismAdd",
    component: resolve => (require(["@/components/Data/Events/BioterrorismEdit"], resolve)),
  },
  {
    path: "/data/events/infectious",
    name: "Infectious",
    component: resolve => (require(["@/components/Data/Events/Infectious"], resolve)),
  },
  {
    path: "/data/events/infectious/:type/:id",
    name: "InfectiousEdit",
    component: resolve => (require(["@/components/Data/Events/InfectiousEdit"], resolve)),
  },
  {
    path: "/data/events/infectious/:type",
    name: "InfectiousAdd",
    component: resolve => (require(["@/components/Data/Events/InfectiousEdit"], resolve)),
  },
  {
    path: "/data/events/weapons",
    name: "Weapons",
    component: resolve => (require(["@/components/Data/Events/Weapons"], resolve)),
  },
  {
    path: "/data/events/weapons/:type/:id",
    name: "WeaponsEdit",
    component: resolve => (require(["@/components/Data/Events/WeaponsEdit"], resolve)),
  },
  {
    path: "/data/events/weapons/:type",
    name: "WeaponsAdd",
    component: resolve => (require(["@/components/Data/Events/WeaponsEdit"], resolve)),
  },
  {
    path: "/data/events/facilities",
    name: "Facilities",
    component: resolve => (require(["@/components/Data/Events/Facilities"], resolve)),
  },
  {
    path: "/data/events/facilities/:type/:id",
    name: "FacilitiesEdit",
    component: resolve => (require(["@/components/Data/Events/FacilitiesEdit"], resolve)),
  },
  {
    path: "/data/events/facilities/:type",
    name: "FacilitiesAdd",
    component: resolve => (require(["@/components/Data/Events/FacilitiesEdit"], resolve)),
  }
];
// 生物装备路由
const rEquip = [
  {
    path: "/data/equip/scout",
    name: "Scout",
    component: resolve => (require(["@/components/Data/Equip/Scout"], resolve)),
  },
  {
    path: "/data/equip/scout/:type/:id",
    name: "ScoutEdit",
    component: resolve => (require(["@/components/Data/Equip/ScoutEdit"], resolve)),
  },
  {
    path: "/data/equip/scout/:type",
    name: "ScoutAdd",
    component: resolve => (require(["@/components/Data/Equip/ScoutEdit"], resolve)),
  },
  {
    path: "/data/equip/detect",
    name: "Detect",
    component: resolve => (require(["@/components/Data/Equip/Detect"], resolve)),
  },
  {
    path: "/data/equip/detect/:type/:id",
    name: "DetectEdit",
    component: resolve => (require(["@/components/Data/Equip/DetectEdit"], resolve)),
  },
  {
    path: "/data/equip/detect/:type",
    name: "DetectAdd",
    component: resolve => (require(["@/components/Data/Equip/DetectEdit"], resolve)),
  },
  {
    path: "/data/equip/fence",
    name: "Fence",
    component: resolve => (require(["@/components/Data/Equip/Fence"], resolve)),
  },
  {
    path: "/data/equip/fence/:type/:id",
    name: "FenceEdit",
    component: resolve => (require(["@/components/Data/Equip/FenceEdit"], resolve)),
  },
  {
    path: "/data/equip/fence/:type",
    name: "FenceAdd",
    component: resolve => (require(["@/components/Data/Equip/FenceEdit"], resolve)),
  }
];
// 生物剂路由
const rRegant = [
  {
    path: "/data/reagent/virus",
    name: "Virus",
    component: resolve => (require(["@/components/Data/Reagent/Virus"], resolve)),
  },
  {
    path: "/data/reagent/virus/fieldEdit/:field/:id/:dId",
    name: "VirusEdit",
    component: resolve => (require(["@/components/Data/Reagent/ReagentFieldEdit"], resolve)),
  },
  {
    path: "/data/reagent/germ",
    name: "Germ",
    component: resolve => (require(["@/components/Data/Reagent/Germ"], resolve)),
  },
  {
    path: "/data/reagent/germ/fieldEdit/:field/:id/:dId",
    name: "GermEdit",
    component: resolve => (require(["@/components/Data/Reagent/ReagentFieldEdit"], resolve)),
  },
  {
    path: "/data/reagent/rickettsiite",
    name: "Rickettsiite",
    component: resolve => (require(["@/components/Data/Reagent/Rickettsiite"], resolve)),
  },
  {
    path: "/data/reagent/rickettsiite/fieldEdit/:field/:id/:dId",
    name: "RickettsiiteEdit",
    component: resolve => (require(["@/components/Data/Reagent/ReagentFieldEdit"], resolve)),
  },
  {
    path: "/data/reagent/fungus",
    name: "Fungus",
    component: resolve => (require(["@/components/Data/Reagent/Fungus"], resolve)),
  },
  {
    path: "/data/reagent/fungus/fieldEdit/:field/:id/:dId",
    name: "FungusEdit",
    component: resolve => (require(["@/components/Data/Reagent/ReagentFieldEdit"], resolve)),
  },
  {
    path: "/data/reagent/poison",
    name: "Poison",
    component: resolve => (require(["@/components/Data/Reagent/Poison"], resolve)),
  },
  {
    path: "/data/reagent/poison/fieldEdit/:field/:id/:dId",
    name: "PoisonEdit",
    component: resolve => (require(["@/components/Data/Reagent/ReagentFieldEdit"], resolve)),
  },
  //lzy20210105
  //新增病毒
  {
    path: "/data/reagent/virus/VirusAdd",
    name: "VirusAdd",
    component: resolve => (require(["@/components/Data/Reagent/VirusAdd"], resolve)),
  },
  //新增细菌
  {
    path: "/data/reagent/germ/VirusAdd",
    name: "GermAdd",
    component: resolve => (require(["@/components/Data/Reagent/VirusAdd"], resolve)),
  },
  //新增立克次氏体
  {
    path: "/data/reagent/rickettsiite/VirusAdd",
    name: "RickettsiiteAdd",
    component: resolve => (require(["@/components/Data/Reagent/VirusAdd"], resolve)),
  },
  //新增真菌
  {
    path: "/data/reagent/fungus/VirusAdd",
    name: "FungusAdd",
    component: resolve => (require(["@/components/Data/Reagent/VirusAdd"], resolve)),
  },
  //新增毒素
  {
    path: "/data/reagent/poison/VirusAdd",
    name: "PoisonAdd",
    component: resolve => (require(["@/components/Data/Reagent/VirusAdd"], resolve)),
  },



  //编辑病毒
  {
    path: "/data/reagent/VirusEdit",
    name: "VirusEdit",
    component: resolve => (require(["@/components/Data/Reagent/VirusEdit"], resolve)),
  },
  //新增病毒概述
  {
    path: "/data/reagent/VirusSummaryAdd",
    name: "VirusSummaryAdd",
    component: resolve => (require(["@/components/Data/Reagent/VirusSummaryAdd"], resolve)),
  },
  //编辑病毒概述
  {
    path: "/data/reagent/VirusSummaryEdit",
    name: "VirusSummaryEdit",
    component: resolve => (require(["@/components/Data/Reagent/VirusSummaryEdit"], resolve)),
  },
  //新增图片案例
  {
    path: "/data/reagent/VirusPicAdd",
    name: "VirusPicAdd",
    component: resolve => (require(["@/components/Data/Reagent/VirusPicAdd"], resolve)),
  },
  //编辑图片案例
  {
    path: "/data/reagent/VirusPicEdit",
    name: "VirusPicEdit",
    component: resolve => (require(["@/components/Data/Reagent/VirusPicEdit"], resolve)),
  },
];

// 数据管理路由
const rData = [
  {
    path: '/data/events',
    name: "EventsPage",
    component: resolve => (require(["@/components/Data/Events/Events"], resolve)),
    redirect: "/data/events/warfare",
    children: rEvents
  },
  {
    path: '/data/equip',
    name: "EquipPage",
    component: resolve => (require(["@/components/Data/Equip/Equip"], resolve)),
    redirect: "/data/equip/scout",
    children: rEquip
  },
  {
    path: '/data/reagent',
    name: "ReagentPage",
    component: resolve => (require(["@/components/Data/Reagent/Reagent"], resolve)),
    redirect: "/data/reagent/virus",
    children: rRegant
  },
  {
    path: '/data/docu',
    name: "DocuPage",
    component: resolve => (require(["@/components/Data/Docu/Docu"], resolve)),
  },
  {
    path: '/data/docu/:type/:id',
    name: "DocuEdit",
    component: resolve => (require(["@/components/Data/Docu/DocuEdit"], resolve)),
  },
  {
    path: '/data/docu/:type',
    name: "DocuAdd",
    component: resolve => (require(["@/components/Data/Docu/DocuEdit"], resolve)),
  },
  {
    path: '/data/video',
    name: "VideoPage",
    component: resolve => (require(["@/components/Data/Video/Video"], resolve)),
  },
  {
    path: '/data/video/:type/:id',
    name: "VideoEdit",
    component: resolve => (require(["@/components/Data/Video/VideoEdit"], resolve)),
  },
  {
    path: '/data/video/:type',
    name: "VideoAdd",
    component: resolve => (require(["@/components/Data/Video/VideoEdit"], resolve)),
  }
];
// 资讯管理路由
const rInfo = [
  {
    path: '/info/news',
    name: 'News',
    component: resolve => (require(["@/components/Info/News"], resolve)),
  },
  {
    path: '/info/news/:type/:id',
    name: 'NewsEdit',
    component: resolve => (require(["@/components/Info/NewsEdit"], resolve)),
  },
  {
    path: '/info/news/:type',
    name: 'NewsAdd',
    component: resolve => (require(["@/components/Info/NewsEdit"], resolve)),
  },
  {
    path: '/info/politics',
    name: 'Politics',
    component: resolve => (require(["@/components/Info/Politics"], resolve)),
  },
  {
    path: '/info/politics/:type/:id',
    name: 'PoliticsEdit',
    component: resolve => (require(["@/components/Info/PoliticsEdit"], resolve)),
  },
  {
    path: '/info/politics/:type',
    name: 'PoliticsAdd',
    component: resolve => (require(["@/components/Info/PoliticsEdit"], resolve)),
  }
];
// 主视图路由
const rHome = [
  {
    path: '/data',
    name: 'DataPage',
    component: resolve => (require(["@/components/Data/index"], resolve)),
    redirect: "/data/events",
    children: rData
  },
  {
    path: '/info',
    name: 'InfoPage',
    component: resolve => (require(["@/components/Info/index"], resolve)),
    redirect: "/info/news",
    children: rInfo
  },
  {
    path: '/user',
    name: 'UserPage',
    component: resolve => (require(["@/components/User/User"], resolve)),
    redirect: "/user/userList",
    children: [
      {
        path: '/user/userList',
        name: 'UserListPage',
        component: resolve => (require(["@/components/User/UserList"], resolve)),
      },
      {
        path: '/user/userList/:type/:id',
        name: 'UserEdit',
        component: resolve => (require(["@/components/User/UserEdit"], resolve)),
      },
      {
        path: '/user/userList/:type',
        name: 'UserAdd',
        component: resolve => (require(["@/components/User/UserEdit"], resolve)),
      }
    ]
  },

];


// 导出路由
export default new Router({
  mode: "history",
  linkActiveClass: 'activeRoute',
  routes: [
    {
      path: '/login',
      name: 'LoginPage',
      component: resolve => (require(["@/components/Login/Login"], resolve)),
    },
    {
      path: '/',
      name: 'HomePage',
      component: resolve => (require(["@/components/Home/Home"], resolve)),
      redirect: "/data",
      children: rHome
    }

  ]
})
